import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/home/goods',
    children: [
      {
        path: '/home/goods',
        component: () => import('@/views/home/Goods.vue')
      },
      {
        path: '/home/shop',
        component: () => import('@/views/home/Shop.vue')
      },
      {
        path: '/home/comment',
        component: () => import('@/views/home/Comment.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login')
  },
  {
    path: '*',
    component: () => import('@/views/404')
  }
]

const router = new VueRouter({
  routes
})

export default router
